package com.sali;

import com.sali.handler.SocketHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.concurrent.ExecutorService;

@EnableScheduling
@SpringBootApplication
public class SaliMockSocketApplication {

    public static void main(String[] args) {
        SpringApplication.run(SaliMockSocketApplication.class, args);
    }

    @Autowired
    @Qualifier("commonExecutor")
    private ExecutorService executorService;

    @Resource
    private SocketHandler socketHandler;


    @PostConstruct
    public void init() {
        executorService.execute(() -> socketHandler.start());
    }

}
